package org.mozhu.zufang.system.privilege.repository;

import org.mozhu.mboot.core.data.BaseRepository;
import org.mozhu.zufang.system.privilege.entity.Role;
import org.springframework.data.jpa.repository.Query;

import java.util.Collection;
import java.util.List;

/**
 * 角色 - 数据访问层接口
 * 
 * @author mozhu
 */
public interface RoleRepository extends BaseRepository<Role, Long> {

	@Query("from Role where activated=true and id in ( ?1 )")
	List<Role> findAvailableRoles(Collection<Long> roleIds);

	@Query("select id from Role where defaultRole=true and activated=true")
	List<Long> findDefaultRoleIds();

	@Query("from Role where defaultRole=true and activated=true")
	List<Role> findDefaultRoles();
}
